/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 purang All Rights Reserved
// Name:        message_sync.h
// Purpose:     
// Author:      syy
// Modified by: 
// Created:     2022/6/15 13:27
// RCS-ID:      
// Licence:     
/////////////////////////////////////////////////////////////////////////////
#ifndef _MESSAGE_SYNC_H_
#define _MESSAGE_SYNC_H_

#include "core/common_types.h"
#include "core/comdefs.h"

// {AFFF9A0B-DCE3-4557-BA5F-A63BA4E75A85}
DEFINE_GUID(IID_IMessageSync, 
			0xafff9a0b, 0xdce3, 0x4557, 0xba, 0x5f, 0xa6, 0x3b, 0xa4, 0xe7, 0x5a, 0x85);

#ifdef __cplusplus
extern "C" {
#endif

    DECLARE_INTERFACE(IMessageSyncObserver/*, IUnknown*/)
	{
		STDMETHOD_(void, OnNetData) (char* pRecvData, int nDataLen) PURE;
        STDMETHOD_(void, OnNetStatus) (int status) PURE;
	};

    DECLARE_INTERFACE(IMessageDispatchObserver/*, IUnknown*/)
    {
        STDMETHOD_(void, PushMessage) (const char* pRecvData, int nDataLen, uint32_t flag, void* tag) PURE;
    };

	DECLARE_INTERFACE_(IMessageSync, IUnknown)
	{
		STDMETHOD_(int32_t,Create) (THIS_) PURE;
		STDMETHOD_(int32_t,Destory) (THIS_) PURE;
		STDMETHOD_(int32_t,PushMessage) (THIS_ const char* buff,uint32_t bytes,uint32_t flag = 0,void* tag = NULL) PURE;
        STDMETHOD_(int32_t,RegisterMessageObserverTUS) (THIS_ IMessageSyncObserver* observer) PURE;
        STDMETHOD_(int32_t,DeRegisterMessageObserverTUS) (THIS_ IMessageSyncObserver* observer) PURE;
        STDMETHOD_(int32_t,RegisterMessageObserverTS) (THIS_ IMessageSyncObserver* observer) PURE;
        STDMETHOD_(int32_t,DeRegisterMessageObserverTS) (THIS_ IMessageSyncObserver* observer) PURE;
        STDMETHOD_(int32_t,RegisterMessageDispatchObserver) (THIS_ IMessageDispatchObserver* observer) PURE;
        STDMETHOD_(int32_t,DeRegisterMessageDispatchObserver) (THIS_ IMessageDispatchObserver* observer) PURE;
        STDMETHOD_(int32_t,DispatchMessage)(const char* buff, uint32_t bytes, uint32_t flag, void* tag) PURE;
	};

#ifdef __cplusplus
}
#endif

#endif // _MESSAGE_SYNC_H_
